<style>
table.tecspec {
  width: 100%;
  max-width: 100%;
  border-bottom: 1px solid #dddddd;
}
table.tecspec>tbody>tr>th {
  border-right: 1px solid #ddd;
}
table.tecspec>tbody>tr>th, table.tecspec>tbody>tr>td {
  padding: 1px;
  line-height: 1.42857143;
  vertical-align: top;
  border-top: 1px solid #ddd;
}
body{
    background-color:white;
}
.detail_booking{
    text-align: center;
    font-weight: bold;
}
h3{
    text-align: center;
    background-color: #E7433C;
    font-size: 24px;
    color: white !important;
}
textarea{width:564px !important;}
</style>

    <h3><?php echo $this->lang->line('info-export-bill');?></h3>
    <?php echo form_open('/auth/bookhistory/exportBill',array('id'=>'ajaxform'));?>
    <table class="tecspec">
        <tbody>
            <tr>
              <th style="width:25%"><?php echo $this->lang->line('exportBy');?></th>
              <td width="75%">
                  <?php
                    echo form_radio(array("name"=>"fare","value"=>0, 'checked'=>set_radio('fare', 0,TRUE))).' '.$this->lang->line('net_fare');//0: gia net
                    echo form_radio(array("name"=>"fare","value"=>1, 'checked'=>set_radio('fare', 1,TRUE))).' '.$this->lang->line('real_fare');//1 gia thuc
                  ?>
              </td>
            </tr>
            
            <tr>
              <th style="width:25%"><?php echo form_label($this->lang->line('infoBill'), 'infoBill');?></th>
              <td width="75%">
                  <?php
                    echo form_textarea(array('name' => 'infoBill', 'id' => 'infoBill', 'value' => ($info->info_bill)?$info->info_bill:'','rows'=>'7'));
                  ?>
              </td>
            </tr>
            
            <tr>
              <th style="width:25%"></th>
              <td width="75%">
                  <?php echo form_checkbox('save_contact', '1', FALSE).$this->lang->line('save_contact');?>
              </td>
            </tr>
            
            <tr>
              <th style="width:25%"></th>
              <td width="75%">
                  <?php echo form_button(array('id' => 'submit', 'value' => 'Update', 'name' => 'submit', 'type' => 'submit', 'content' => $this->lang->line('save'),'class' => 'btn btn-primary'));?>
                  <span style="padding:0 10px;"><?php echo form_button(array('id' => 'cancel','content' => $this->lang->line('close'),'class' => 'btn btn-danger')); ?></span>
              </td>
            </tr>
            <input type="hidden" name="customerID" value="<?php echo $info->customerID; ?>" />
        </tbody>
    </table>
    <?php form_close();?>

<link rel="stylesheet" href="<?php echo base_url();?>third_party/bootstrap/css/bootstrap.min.css" />
<script src="<?php echo STATIC_URL.'libs/js/ajax.js'?>"></script>
<script>
$(document).ready(function() {
        $('button[type="submit"]').attr('disabled','disabled');
        $( "#infoBill" ).bind({
                click: function() {
                  // Do something on click
                  if($("#infoBill").val() != null){
                      $('button[type="submit"]').removeAttr('disabled');
                  }
                }
        });
        $("#ajaxform").submit(function(e)
        {
            var postData = $(this).serializeArray();
            var formURL = $(this).attr("action");
            setTimeout(function () {
                $.ajax(
                    {
                        url : formURL,
                        type: "POST",
                        data : postData,
                        cache: true,
                        beforeSend: function(){
                            console.log(1);
                        },
                        success:function(data) 
                        {
                            if(data == 1){
                                window.top.location.href="/auth/listexport/";
                            }
                        },
                        error: function() 
                        {
                            alert("Lỗi! Contact Admin!");
                        }
                    });
            }, 222);
            e.preventDefault();	//STOP default action
        });
        
        $("#cancel").on('click',function(e){
                parent.jQuery.fancybox.close();
                e.preventDefault();	//STOP default action
        });
});
</script>